﻿
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title> 
    <link href="../../../../DataUser/Style/ccbpm.css" rel="stylesheet"  type="text/css" />
    <link href="../../../Scripts/easyUI/themes/default/easyui.css" rel="stylesheet" type="text/css" />
    <link href="../../../Scripts/easyUI/themes/icon.css" rel="stylesheet" type="text/css" />
    <script src="../../../Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
    <script src="../../../Scripts/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../../Scripts/QueryString.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../../Comm/Gener.js"></script>
    <script src="DDLBar.js" type="text/javascript"></script>
    <script src="../../CCFlowEnum.js" type="text/javascript"></script>
    <script src="../../../Scripts/EasyUIUtility.js" type="text/javascript"></script>

    <script  type="text/javascript">

        $(function () {

            InitBar(DeliveryWay.BySpecNodeEmpStation);
            var html = "";

            var nd = new Entity("BP.WF.Node", GetQueryString("FK_Node"));
            var nodes = new Entities("BP.WF.Nodes");
            nodes.Retrieve("FK_Flow", nd.FK_Flow);
            var paras = nd.DeliveryParas;
            var strList = new Array();
            strList = paras.split(',');
            var setHtml = "<table>";
            setHtml += "<caption>请选择要指定的节点</caption>";
            setHtml += "<tr>";
            setHtml += "<th>序号</th>";
            setHtml += "<th>名称</th>";
            setHtml += "<th>节点ID</th>";
            setHtml += "<th>步骤</th>";
            setHtml += "</tr>";
            var idx = 0;

            for (var i = 0; i < nodes.length; i++) {
                var checkFlag = false;
                var mynd = nodes[i];
                var nodeID = mynd.NodeID;
                var nodeName = mynd.Name;
                if (nd.DeliveryWay == DeliveryWay.BySpecNodeEmpStation) {
                    for (var j = 0; j < strList.length; j++) {
                        if (nodeID == strList[j]) {
                            checkFlag = true;
                            continue;
                        }
                    }
                }


                idx++;
                setHtml += "<tr>";
                setHtml += "<td class=Idx >" + idx + "</td>";

                setHtml += "<td>";
                if (checkFlag) {
                    setHtml += "&nbsp;&nbsp;&nbsp;<input id='RB_NodeNo_" + i + "' type='checkbox' name='RB_NodeNo' value=" + nodeID + " checked=checked/>";
                } else {
                    setHtml += "&nbsp;&nbsp;&nbsp;<input id='RB_NodeNo_" + i + "' type='checkbox' name='RB_NodeNo' value=" + nodeID + " />";
                }
                setHtml += "<label for='RB_NodeNo_" + i + "' >名称:" + nodeName + "</label>";

                setHtml += "</td>";
                setHtml += "<td>" + nodeID + "</td>";
                setHtml += "<td>" + mynd.Step + "</td>";
                setHtml += "</tr>";
            }
            setHtml += "</table>";

            document.getElementById("NodeSelect").innerHTML = setHtml;

        });

        function Save() {
            var nodeID = GetQueryString("FK_Node");
            var node = new Entity("BP.WF.Node", nodeID);
            node.DeliveryWay = DeliveryWay.BySpecNodeEmpStation;
            var object = document.getElementsByName("RB_NodeNo");
            var DeliveryParas = "";
            for (var i = 0; i < object.length; i++) {
                if (object[i].checked) {
                    DeliveryParas += object[i].value;
                    if (i < object.length - 1)
                        DeliveryParas += ',';
                }
            }
            node.DeliveryParas = DeliveryParas;
            node.Update();
            alert("保存成功.");
        }
    </script>
</head>
<body >

<div id="bar"> </div>

    <div id="NodeSelect"  style="margin-top:10px;margin-bottom:10px"></div>

</body>
</html>
